import { lazy } from "react";
import { createBrowserRouter } from "react-router-dom";
//一级路由
const Home = lazy(() => import("../pages/Home/Home"));
const Login = lazy(() => import("../pages/Login/Login"));
const Request = lazy(() => import("../pages/Request/Request"));
const Error = lazy(() => import("../pages/404/Error"));
//二级路由
const List = lazy(() => import("../pages/List/List"));
const Detail = lazy(() => import("../pages/Detail/Detail"));
const Detail2 = lazy(() => import("../pages/Detail/DeTail2"));
const Detail3 = lazy(() => import("../pages/Detail/DeTail3"));
const User = lazy(() => import("../pages/User/User"));
export const HomeRouter = [
  {
    path: "/List",
    element: <List></List>,
  },
  {
    path: "/Detail",
    element: <Detail></Detail>,
  },
  {
    path: "/Detail2",
    element: <Detail2></Detail2>,
  },
  {
    path: "/Detail3",
    element: <Detail3></Detail3>,
  },
  {
    path: "/User",
    element: <User></User>,
  },
];
//一级路由配置
const router = createBrowserRouter([
  {
    path: "/",
    element: <Home></Home>,
    children: HomeRouter,
  },
  {
    path: "/Login",
    element: <Login></Login>,
  },
  {
    path: "/Request",
    element: <Request></Request>,
  },
  {
    path: "/Error",
    element: <Error></Error>,
  },
]);
export default router;
